package org.example.juc.atomic;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomticIntegerTest {

    static AtomicInteger atomticInteger = new AtomicInteger(0);

    public static void main(String[] args) {
        Long start =System.currentTimeMillis();
        for (int i = 0; i < 500000; i++) {
            new Thread(() -> {
                isum();
            }).start();

        }
        Long end =System.currentTimeMillis();
        System.out.println("耗时："+(start-end));

    }

    static void isum() {

        atomticInteger.incrementAndGet();
        System.out.println(atomticInteger.get());
    }
}

